#include <stdio.h>

//写文件内容
int main0(int argc, char **args)
{
    if (argc < 2)
        return 0;
    FILE *p = fopen(args[1], "w");
    if(p)
    {
        while(1)
        {
            char c = getchar();
            if(c == '0')
                break;
            putc(c, p);
        }
        fclose(p);
    }
    return 0;
}

//读取文件内容
//相当于cat()这个函数
int main(int argc, char **args)
{
    if (argc < 2)
        return 0;
     FILE *p = fopen(args[1], "r");
     if (p)
     {
         char c = getc(p);
         while (c != EOF)
         {
             printf("%c", c);
             c = getc(p);
         }
         fclose(p);
     }
     return 0;
}
